package dujiu.luogu.branch;

import java.util.Scanner;

public class P1085 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] arr = new int[7];
        int total_time = 8;
        int index = 0,schoolTime,extraTime = 0;
        int max = 0;
        for (int i = 0; i < 7; i++) {
            schoolTime = scanner.nextInt();
            extraTime = scanner.nextInt();
            arr[i] = schoolTime + extraTime;
            if ((arr[i] > total_time)&&arr[i] > max){
                max = arr[i];
                index = i+1;
            }
        }
        System.out.println(index);
        scanner.close();
    }
}
